import React from 'react';
class ClassDemo extends React.Component{
  render() {
    return (
      <div>
        <h1>Hello, world!</h1>
        <p>It is {new Date().toLocaleTimeString()}.</p>
      </div>
    );
  }
  constructor() {
    super();
    this.arr = [];
  }
  add(num) {
    this.arr.push(num);
  }
  sum() {
    return this.arr.reduce((a, b) => a + b, 0);
  }
}

export default ClassDemo;